const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('energy_company', {
    id: {
      type: DataTypes.STRING(40),
      allowNull: false,
      primaryKey: true
    },
    year: {
      type: DataTypes.STRING(6),
      allowNull: true
    },
    month: {
      type: DataTypes.STRING(2),
      allowNull: true
    },
    company: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "公司"
    },
    createElectricity: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "发电量"
    },
    useElectricity: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "用电量"
    },
    carbon: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "碳减排量"
    },
    water: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "用水量"
    },
    charge: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "充电次数"
    },
    chargeCapacity: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "充电量"
    },
    gas: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "燃气量"
    },
    companyId: {
      type: DataTypes.STRING(40),
      allowNull: true,
      comment: "公司id"
    }
  }, {
    sequelize,
    tableName: 'energy_company',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
